import socket
import threading


server=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.bind(('0.0.0.0',8000))
server.listen()
def handle_sock(sock,addr):
    while True:
        data=sock.recv(1024).decode('utf-8')
        print(data)
        re_data=input('>>>>').encode('utf-8')
        sock.send(re_data)

while True:
    sock, addr = server.accept()
    client_thread=threading.Thread(target=handle_sock,args=(sock,addr))
    client_thread.start()




    # data=sock.recv(1024)
    # print(data.decode('utf-8'))
    # ret_data=input('>>>>>').encode('utf-8')
    # sock.send(ret_data)


# sock.close()
# server.close()